#pragma once
void swap(char* a, char* b, size_t width)
{
	int i;
	char tmp;
	for (i = 0; i < width; i++)
	{
		tmp = *b;
		*b = *a;
		*a = tmp;
		a++;
		b++;
	}
}
void my_bbsort(void* base, size_t sz, size_t width, int (*cmp)(const void* p1, const void* p2))
{
	int i = 0, j = 0;
	for (i = 0; i < sz - 1; i++)
		for (j = 0; j < sz - i - 1; j++)
		{
			if (cmp((char*)base + j * width, (char*)base + (j + 1) * width) > 0)
				swap((char*)base + j * width, (char*)base + (j + 1) * width, width);
		}
}
